<?php

class Field extends CFormModel {
	public $economicSector;
	public $businessSector;
	public $industryGroup;
	
	public function rules() {
		return array(
			array('economicSector','required'),
			array('businessSector','required'),
			array('industryGroup','required')
		);
	}
	
	public function attributeLabels() {
		return array(
			'answer'=>'Choose the most appropriate business field?',
		);
	}
	
	public function getForm() {
		return new CForm(array(
			'showErrorSummary'=>true, 
			'attributes'=>array('id'=>'survey'),
			'elements'=>array(
		
				'economicSector'=>array(
					'type'=>'dropdownlist',
					'id'=>'esector_id',
					'items'=>CHtml::listData(EconomicSector::model()->findAll(),'id','name'),
					'layout'=>'{label}<br/>{input}<br/>{error}',
				),
				'businessSector'=>array(
					'type'=>'dropdownlist',
					'id'=>'bsector_id',
					'items'=>CHtml::listData(BusinessSector::model()->findAll(),'id','name'),
					'layout'=>'{label}<br/>{input}<br/>{error}'
				),
			
				'industryGroup'=>array(
					'type'=>'dropdownlist',
					'items'=>CHtml::listData(IndustryGroup::model()->findAll(),'id','name'),
					'layout'=>'{label}<br/>{input}<br/>{error}'
				),
			),
			'buttons'=>array(
				'submit'=>array(
					'type'=>'submit',
					'label'=>'Next'
				)
			)
		), $this);
	}
}